import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
@Entity('sys_user')
export class UserEntity {
  @PrimaryGeneratedColumn()
  id: number; // 标记为主键，值自动生成
  @Column({ select: false, length: 30 })
  open_id: string;
  @Column({ length: 20, default: () => "'0'" })
  user_name: string;
  @Column({ length: 255, default: () => "'/uploads/icons/Qq (97).jpg'" })
  avatar: string;
  @Column({ length: 10, default: () => "'none'" })
  user_source: string;
  @Column({ select: false, default: () => "'0'" })
  password: string;
  @Column({ length: 100, default: () => "''" })
  user_token: string;
  @Column({ type: 'datetime', default: () => 'NOW()', comment: '最后登录时间' })
  last_login_time: Date;
  @Column({ type: 'datetime', default: () => 'NOW()' })
  create_time: Date;
  @Column({
    type: 'datetime',
    default: () => 'NOW()',
    // onUpdate: () => 'NOW()', // 添加这行实现自动更新
  })
  update_time: Date;
}
